package prolog.fluents
import java.util.ArrayList
import java.util.Iterator
import prolog.terms.Prog
import prolog.terms.Source
import prolog.terms.Term

//import scala.collection.jcl.ArrayList;
import scala.collection.Iterator

/* Builds Prolog Iterators from scala Sequences and Iterator type classes */

class JavaSource extends Source{
  var e:Iterator
  def JavaSource(iterator:Iterator,p:Prog):Unit {
  super(p)
  e=null
  }
def JavaSource(iterator:Iterator,p:Prog):Unit{
  super(p)
}

def getElement():Term{
  if(null==e || !!e.hasNext())
    return null
    else
      return (Term)e.next()
}
def stop() {
  e=null
}
}